package com.netty.sever;

import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelId;

import java.util.HashMap;
import java.util.Map;

/**
 * @description:
 * @date 2020-04-02 15:09
 * @author: liujinhu
 */
public class ListUserHandler extends Thread{

    public static Map<ChannelId, ChannelHandlerContext> map = new HashMap<>();
    @Override
    public void run() {
        while (true) {
            map.entrySet().stream().forEach(p->{


                p.getValue().writeAndFlush(p.getKey()+"——发送消息");

            });
            try {
                Thread.sleep(2000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
